
import { defineStore } from 'pinia'

// count 是唯一id
export const useCountStore = defineStore('count', {
    state() {
        return {
            count: 1
        }
    },
    // getters 是 store 的计算属性 (computed)
    getters: {
        double: (state) => state.count * 2,
    },
    // 而 actions 则是方法 (methods)
    actions: {
        increment() {
            this.count++
        },
    },
})

